home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Essentials / MacApp Documentation / MacApp.TECH$ Archives / 1990 / Jan 90 / MacApp.Tech$ 1⁄19⁄90 / 0441-RE InsideOut ErrorHa-Jan90 < prev    next >
Encoding:
Text File  |  1991-03-06  |  2.7 KB  |  61 lines  |  [TEXT/GEOL]

  1. Item    5220358                         17-Jan-90        09:40
  2.  
  3. From:   MADA2                           MacApp Dev Assoc, Curtis Faith
  4.  
  5. To:     AUST0134                        Jam Software Sydney
  6.  
  7. cc:     MACAPP.TECH$                    MacApp Technical
  8.  
  9. Sub:    RE:InsideOut ErrorHandling
  10.  
  11. Tseung,
  12.  
  13. I have spent considerable time thinking about InsideOut and MacApp and their
  14. relationship.  I have come to the conclusion that the best thing to do about
  15. InsideOut error handlers is to dispense with them altogether.
  16.  
  17. While the InsideOut scheme is laudable and otherwise excellent it is difficult
  18. to fit it into the MacApp scheme,  as is evidenced by your scheme's admitted
  19. convolution.
  20.  
  21. MacApp has its own Failure mechanism that is more general and also quite
  22. excellent and thus in the interest of uniformity and readability I have
  23. implemented the following scheme:
  24.  
  25. 1) I have place a layer of abstraction between InsideOut calls and My
  26. application.  This has the effect of simplifying the interface for the usual
  27. case and also allows one to handle InsideOut errors in a uniform way.  Here is
  28. my interface for the Insert call:
  29.  
  30.     PROCEDURE TInsideOutDB.Insert (theDBRefNum: Integer;
  31.                                     theData: UNIV Ptr;
  32.                                     doHandleErrors: Boolean);
  33.  
  34. 2) If doHandleErrors is TRUE then the method calls another routine HandleError
  35. which checks the result of DBError and if it is not noErr (or 0) it will call
  36. failure with the result of DBError as the error parameter and a special message
  37. number for InsideOut Errors that will call up a dialog box with the normal
  38. 'errs' resource stuff.
  39.  
  40. 3) At times one may not want an error to always result in a call to failure as
  41. some errors may be normal.  If one is reading in a list of records using the
  42. Next call one should expect kNoNextRec as a normal result of reaching the end
  43. of the set of records that match .  Thus in this case one can call Next with
  44. doHandleErrors FALSE and then explicitly test the error, calling HandleError if
  45. an error is neither kNoNextRec nor noErr.
  46.  
  47. Thus the abnormal or unexpected case results in a call to failure.  One can use
  48. one MacApp failure handler to do what one might have done within an InsideOut
  49. failure handler and also clean up MacApp objects.
  50.  
  51. I think that in most instances it is preferable to have one mechanism if one
  52. can serve the same purpose as two.  Generally, one failure handler is all that
  53. is needed since it usually matters little whether failure comes about as the
  54. result of an InsideOut call or something else.  One can just as easily test for
  55. specific InsideOut errors inside a MacApp failure handler as an InsideOut one.
  56.  
  57. I have found the above scheme to be quite workable and satisfactory.
  58.  
  59. - Curtis
  60.  
  61.